<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>含参积分与特殊函数</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="../../css/note.css" />
</head>
<body>

<h2>含参积分</h2>

<h3>几个著名积分</h3>

<p class="example">
	<b>Poisson 积分 (或 Euler-Poisson 积分, 概率积分)</b>
  <span class="formula">
    `int_(-oo)^oo "e"^(-x^2) dx = sqrt pi`.
  </span>
  推广:
  <span class="formula">
    `int_(-oo)^oo "e"^(-a x^2) cos b x dx`
    `= sqrt(pi/a) "e"^(-b^2/(4a))`.
  </span>
</p>

<p class="proof">
  利用重积分.  设 `D` 是以原点为心, `R` 为半径的圆盘,
  <span class="formula">
    `iint_D "e"^(-x^2-y^2) dx dy`
    `= int_0^(2pi) "d"theta int_0^R "e"^(-r^2) r"d"r`
    `= pi(1 - "e"^(-R^2))`.
  </span>
  另一方面,
  <span class="formula">
    `iint_([-R,R]xx[-R,R]) "e"^(-x^2-y^2) dx dy`
    ` = int_(-R)^R "e"^(-x^2) dx int_(-R)^R "e"^(-y^2) dy`
    ` = (int_(-R)^R "e"^(-x^2) dx)^2`.
  </span>
  令 `R to +oo`, 得 `int_(-oo)^oo "e"^(-x^2) dx = sqrt pi`.
</p>

<ol class="proof">
  <li>
  利用伸缩变换 `x = t y`,
  <span class="formula">
    `I = int_0^oo "e"^(-t^2 y^2) t dy`
  </span>
  对任意 `a gt 0`, 交换积分次序得
  <span class="formula">
    `int_a^oo "e"^(-t^2) I dt`
    `= int_a^oo int_0^oo "e"^(-t^2) "e"^(-t^2 y^2) t dy dt`
    `= int_0^oo int_a^oo "e"^(-t^2 (1+y^2)) t dt dy`
    `= 1/2 int_0^oo "e"^(-a^2(1+y^2))/(1+y^2) dy`
  </span>
  等式两边令 `a to 0^+`, 右边的积分关于 `a` 一致收敛, 得
  <span class="formula">
    `I^2 = 1/2 int_0^oo dy/(1+y^2) = pi/4`,
  </span>
  即 `I = sqrt(pi)/2`.
  </li>
  <li>
  现在证明积分交换的合理性. 考虑被积函数
  <span class="formula">
    `f(t, y) = t "e"^(-t^2(1+y^2))`,
    `quad t ge a gt 0`, `y ge 0`.
  </span>
  该函数在定义域内非负连续, 设 `t "e"^(-t^2) le M`, 则被积函数可以被 `y` 的函数控制:
  <span class="formula">
    `f(t, y) le M "e"^(-t^2 y^2) le M "e"^(-a^2 y^2)`.
  </span>
  这说明积分 `int_0^oo f(t, y) dy` 关于 `t ge a` 一致收敛;
  另一方面被积函数也可以被 `t` 的函数控制:
  <span class="formula">
    `f(t, y) le t "e"^(-t^2)`,
  </span>
  从而积分 `int_a^oo f(t, y) dt` 关于 `y ge 0` 一致收敛, 这两个一致收敛保证了积分换序可以进行.
  </li>
</ol>

<p class="remark">
	`"e"^(-x^2)` 称为 <b>Gauss 函数</b>,
	<span class="formula">
		`"erf"(x) = 2/(sqrt pi) int_0^x "e"^(-t^2) dt`,
		`quad "erfc"(x) = 1-"erf"(x) = 2/(sqrt pi) int_x^oo "e"^(-t^2) dt`
	</span>
	分别称为<b>误差函数</b>和<b>互补误差函数</b>.
</p>

<p class="remark">
  虽然是一维的积分, 却应当考虑用重积分来解决,
  从更高的维度上给原问题以降维打击.
</p>

<p class="example">
	<b>Dirichlet 积分</b>
  <span class="formula">
    `int_(-oo)^oo (sin x)/x dx = pi`.
  </span>
  推广:
  <span class="formula">
    `int_0^oo "e"^(-a x) (sin b x)/x dx = arctan{:b/a:}`.
  </span>
</p>

<ol class="proof">
  <li>收敛性. 由于被积函数是偶函数, 只需考虑 `(0, +oo)` 上的情形:
    <span class="formula">
      `int_0^oo (sin x)/x dx = int_0^(pi/2) + int_(pi/2)^oo`.
    </span>
    第一项是普通的定积分, 我们来说明第二项收敛. 分部积分:
    <span class="formula">
      `|int_(pi/2)^oo (sin x)/x dx|`
      `= |int_(pi/2)^oo (cos x)/x^2 dx|`
      `le int_(pi/2)^oo dx/x^2`.
    </span>
    因此原积分收敛.
    也可以利用 Dirichlet 判别法:
    `int_0^c sin x dx` 关于积分上限 `c` 有界,
    `1/x` 单调趋于 `0`, 因此原积分收敛.
  </li>
  <li>计算. 利用
    <span class="formula">
      `int_0^oo "e"^(-x y) dy = 1/x`,
    </span>
    交换积分次序得
    <span class="formula">
      `int_0^oo (sin x)/x dx`
      `= int_0^oo sin x dx int_0^oo "e"^(-x y) dy`
      `= int_0^oo dy int_0^oo "e"^(-x y) sin x dx`
      `= int_0^oo dy/(y^2+1) = pi/2`.
    </span>
    于是原式等于 `pi`.
  </li>
  <li>积分换序的合理性.
    考察被积函数
    <span class="formula">
      `f(x, y) = sin x "e"^(-x y)`,
      `quad x ge 0, y ge 0`.
    </span>
    当 `x ge a gt 0` 时, `|f(x, y)| le "e"^-a y`;
    当 `y ge c gt 0` 时, `|f(x, y)| le sin x "e"^(-c x)`.
    从而 `int_a^oo f(x,y) dy` 关于 `x` 一致收敛, `int_c^oo f(x,y) dx` 关于
    `y` 一致收敛.
    ??
  </li>
</ol>

<p class="example">
  <b>Fresnel 积分</b>
  <span class="formula">
    `int_(-oo)^oo sin x^2 dx = int_(-oo)^oo cos x^2 dx = sqrt(pi/2)`.
  </span>
  推广:
  <span class="formula">
    `int_0^oo sin x^n dx // sin{:pi/(2n):}`
    `= int_0^oo cos x^n dx // cos{:pi/(2n):}`
    `= 1/n Gamma(1/n)`, `quad n gt 1`.
  </span>
</p>

<p class="proof">
  令 `t = x^2`,
  <span class="formula">
    `int_(-oo)^oo sin x^2 dx = int_0^oo sin t dt/sqrt t`.
  </span>
  利用
  <span class="formula">
    `2/sqrt pi int_0^oo "e"^(-t u^2) "d"u = 1/sqrt t`,
  </span>
  交换积分次序得
  <span class="formula">
    `int_0^oo sin t dt/sqrt t`
    `= 2/sqrt pi int_0^oo sin t dt int_0^oo "e"^(-t u^2) "d"u`
    `= 2/sqrt pi int_0^oo "d"u int_0^oo "e"^(-t u^2) sin t dt`
    `= 2/sqrt pi int_0^oo ("d"u)/(1+u^2)`
    `= 2/sqrt pi * pi/(2 sqrt 2)`
    `= sqrt(pi / 2)`.
  </span>
  合理性??
</p>

<ol class="corollary">
  <li>`int_0^oo x^(-ln x) dx`
      `==^(x="e"^t) int_-oo^oo "e"^(t-t^2) dt`
      `= int_-oo^oo "e"^(-(t-1//2)^2+1//4) dt`
      `= "e"^(1//4) sqrt pi`.
  </li>
  <li>
    `int_0^oo (1-cos x)/x^2 dx`
    `= -(1-cos x)/x |_0^oo + int_0^oo (sin x)/x dx`
    `= pi/2`.<br>
    `int_0^oo (cos a x - cos b x)/x^2 dx`
    `= int_0^oo ((1-cos b x) - (1-cos a x))/x^2 dx`
    `= pi/2(b - a)`.
  </li>
</ol>

<p class="example">
  <b>Froullani 积分</b>
  设 `a, b gt 0`, `f` 在 `x ge 0` 时连续, 且 `f(+oo)` 有限, 则
  <span class="formula">
    `int_0^oo (f(a x) - f(b x))/x dx = (f(0) - f(+oo)) ln{:b/a:}`.
  </span>
  例如, `int_0^oo ("e"^(-a x) - "e"^(-b x))/x dx = ln{:b/a:}`.
</p>

<p class="example">
  `int_0^1 (x^b - x^a)/(ln x) dx`, `a, b gt 0`.
</p>

<p class="solution">
  交换积分次序, 原式等于
  <span class="formula">
    `int_0^1 dx int_a^b x^y dy`
    `= int_a^b dy/(y+1)`
    `= ln{:(b+1)/(a+1):}`.
  </span>
</p>

<p class="example">
  `2n-1 lt 15` 时,
  <span class="formula">
    `int_0^oo prod_(k=1)^n (sin(x//(2k-1)))/(x//(2k-1)) dx = pi/2`.
  </span>
  然而 `2n-1 = 15` 时, 等号不成立.
</p>

<p class="proof">
  `2n-1 = 3` 时, 运用积化和差,
  <span class="formula">
    `int_0^oo (sin x)/x (sin(x//3))/(x//3) dx`
    `= 3/2 int_0^oo (cos (2x//3) - cos (4x//3))/x^2 dx`
    `= 3/2 (4/3 - 2/3) pi/2 = pi/2`.
  </span>
  ??
</p>

<h3>杂例</h3>

<ol class="example">
	<li>`int_0^1 (ln(1+x))/(1+x^2) dx`;</li>
	<li>`int_(-oo)^oo "e"^(-x^2)/(1+x^2) dx`;</li>
  <li>`I(s) = int_0^pi ln(s + cos x) dx`, `s gt 1`.</li>
</ol>

<ol class="solution">
	<li>令 `I(s) = int_0^1 (ln(1+s x))/(1+x^2) dx`, 积分号下求导,
		<span class="formula">
			`I(1) = int_0^1 I'(s) "d"s`
			`= int_0^1 (int_0^1 x/(1+x^2) dx/(1+s x) dx) "d"s`
			`= int_0^1 ((ln 2)/2 1/(1+s^2) + pi/4 s/(1+s^2)
			- (ln(1+s))/(1+s^2) ) "d"s`
			`= pi/4 ln 2 - I(1)`.
		</span>
    所以 `I(1) = pi/8 ln 2`.<br/>
    方法二 [来自 群友 ζ(me)=0] 令 `x = tan t`, 原式化为
    <span class="formula">
      `int_0^(pi/4) ln(1+tan t) dt`
      `= int_0^(pi/8) + int_(pi/8)^(pi/4)`
      `= int_0^(pi/8) (ln(1+tan t) + ln(1+tan(pi/4-t))) dt`
      `= int_0^(pi/8) (ln(1+tan t) + ln(2/(1+tan t))) dt`
      `= int_0^(pi/8) ln 2 dt`
      `= pi/8 ln 2`.
    </span>
	</li>
	<li>令 `I(s) = int_0^oo "e"^(-s x^2)/(1+x^2) dx`, 积分号下求导,
		<span class="formula">
			`I'(s) = int_0^oo (-x^2 "e"^(-s x^2))/(1+x^2) dx`
			`= I(s) - int_0^oo "e"^(-s x^2) dx`
			`= I(s) - 1/2 sqrt(pi/s)`.
		</span>
		上述常微分方程通解为 `I(s) = sqrt pi "e"^s int_s^c "e"^(-y^2) dy`.
		代入 `I(0) = pi/2` 知 `c = +oo`. 因此 `I(1) = sqrt pi "e"
		int_1^oo "e"^(-y^2) dy`, 原式等于
		<span class="formula">
			`2 I(1) = pi "e" 2/sqrt pi int_1^oo "e"^(-y^2) dy`
			`= pi "e"\ "erfc"(1)`.
		</span>
	</li>
  <li>
    对参数求导, 利用万能公式积分
    <span class="formula">
      `I'(s)`
      `= int_0^pi dx/(s + cos x)`
      `= cdots = pi/sqrt(s^2-1)`.
    </span>
    注意
    <span class="formula">
      `I(1) = int_0^pi ln(1+cos x) dx`
      `= int_0^pi ln(2 cos^2{:x/2:}) dx`
      `= -pi ln 2`,
    </span>
    所以
    <span class="formula">
      `I(s) = I(1) + int_1^s I'(t) dt`
      `= -pi ln 2 + pi ln (s + sqrt(s^2-1))`
      `= pi ln {:(s+sqrt(s^2-1))/2:}`.
    </span>
  </li>
</ol>

<p class="example">
  [武理 叶子昊 bilibili: 努力math]<br/>
  `int_0^(pi/2) (x sin x)/(1+cos^2 x) dx`
  `= int_0^(pi/2) arctan(cos x) dx = pi^2/8 - 1/2 ln^2(1+sqrt2)`.</p>

<p class="proof">
  记 `I(s) = int_0^(pi/2) arctan(s cos x) dx`, 则
  <span class="formula">
    `I(1) = int_0^1 I'(s) "d"s`
    `= int_0^1 int_0^(pi/2) cos x/(1 + s^2 cos^2 x) dx "d"s`
    `= int_0^1 int_0^1 dt/(1 + s^2 - s^2 t^2) "d"s`
    `= int_0^1 1/(2s^2 sqrt(1+s^-2)) ln{:(sqrt(1+s^-2) + 1)/(sqrt(1+s^-2)
    - 1):} "d"s`
    `= int_0^1 ("arsh" s)/(s^2 sqrt(1+s^-2)) "d"s`
    `= -int_0^1 ("arsh" s)/sqrt(1+s^-2) "d"(1/s)`
    `= -["arsh" s * "arsh" 1/s]_0^1 + int_0^1 ("arsh"1/s)/sqrt(1+s^2) "d"s`
    `= -ln^2(1+sqrt 2) + int_1^oo ("arsh"s)/(s^2 sqrt(1+s^-2)) "d"s`
    `= -ln^2(1+sqrt 2) + I(+oo) - I(1)`
    `= -ln^2(1+sqrt 2) + int_0^oo (pi dx)/(2 sqrt(1-x^2)) - I(1)`,
  </span>
  整理即得结论.
</p>

<ol class="example">
  [<a href="https://math.stackexchange.com/questions/2733923/evaluate-int-0-infty-frac-ln-x-sin-xxdx" target="_blank">stack exchange</a>], `gamma` 为 Euler 常数:
  <li>
    `int_0^oo sin x/x ln x dx = -pi/2 gamma`;
  </li>
  <li>`int_0^oo sin x/x ln^2 x dx = pi/2 gamma^2 + pi^3/24`.</li>
</ol>

<h2>Euler 积分</h2>

<h3>第一类 Euler 积分: Beta 函数</h3>

<span class="formula">
	`B(x+1, y+1) = int_0^1 t^x (1-t)^y dt`.
</span>

<p class="property">
	`0`, `1` 是 Beta 函数积分的瑕点; `B(x, y)` 在 `x, y gt 0` 时收敛.
</p>

<p class="property">
	<b>对称性</b>
	作变元替换 `s = 1-t` 可得, `B(x, y) = B(y, x)`.
</p>

<p class="property">
	<b>递推公式</b>
	`B(x+1, y) = x/(x+y) B(x, y)`.
</p>

<p class="proof">
	分部积分,
	<span class="formula">
		`B(x+1, y) = -1/y t^x (1-t)^y |_0^1
		+ x/y int_0^1 (1-t)^y t^(x-1) dt`
		`= x/y (int_0^1 (1-t)^(y-1) t^(x-1) dt
		- int_0^1 (1-t)^(y-1) t^x dt)`
		`= x/y (B(x, y) - B(x+1, y))`.
	</span>
	移项整理即得结论.
</p>

<p class="corollary">
	`B(m+1, n+1) = (m! n!)/((m+n+1)!)`, `m, n` 是非负整数.
</p>

<ol class="property">
	<b>Beta 函数的其它形式</b>
	<li>令 `t = sin^2 theta`, 则
		`B(x, y) = 2 int_0^(pi//2) sin^(2x-1) theta
		cos^(2y-1) theta "d"theta`.
	</li>
	<li>令 `t = u/(1+u)`, 则 `B(x, y) = int_0^oo u^(x-1)/(1+u)^(x+y)
		"d"u`. 特别 `B(x, 1-x) = int_0^oo u^(x-1)/(1+u) "d"u`.
	</li>
	<li>由上一式得 `B(x, y) = int_0^1 u^(x-1)/(1+u)^(x+y) "d"u`
		`+ int_1^oo u^(x-1)/(1+u)^(x+y) "d"u`.
		对第二项积分作变换 `u = 1/v` 得
		`B(x, y) = int_0^1 (u^(x-1) + u^(y-1))/(1+u)^(x+y) "d"u`.
	</li>
</ol>

<p class="example">
  <b>点火公式</b>
	`I_n = int_0^(pi/2) sin^n x dx = int_0^(pi/2) cos^n x dx`
	`= 1/2 B((n+1)/2, 1/2)`
	`= {
		((n-1)!!)/(n!!), if n " is odd";
		((n-1)!!)/(n!!) * pi/2, if n " is even";
	:}`
	由此得到 Beta 函数在一些半整数点的取值.
</p>

<p class="solution">
	化为 Beta 函数:
	<span class="formula">
		`I_n` (令 `x = arcsin u`)
		`= int_0^1 u^n/sqrt(1 - u^2) "d"u` (令 `u=sqrt v`)
		`= 1/2 int_0^1 v^(n/2 - 1/2) / sqrt(1-v) "d"v`
		`= 1/2 int_0^1 v^((n+1)/2 - 1) (1-v)^(1/2 - 1) "d"v`
		`= 1/2 B((n+1)/2, 1/2)`.
	</span>
</p>

<p class="solution">
	利用第 6 章的 <a href="6.html#exp-int-sin-n-x">例题</a>, 容易得到
	<span class="formula">
		`I_n = (n-1)/n I_(n-2)`.
	</span>
	易求得 `I_0 = pi/2`, `I_1 = 1`. 由递推公式马上得到上面的结论.
</p>

<p class="example" id="for-wallis">
	<b>Wallis 公式</b>
  `lim_(n to oo) {:(2n)!!:}^2/((2n-1)!!(2n+1)!!) = pi/2`.
	尽管只有乘除法因而计算简便, 但 Wallis 公式的收敛速度不快,
	不适合直接用来计算 `pi`.
</p>

<p class="proof">
  利用
	<span class="formula">
		`sin^(2n+1) x le sin^(2n) x le sin^(2n-1) x`, `quad 0 le x le
		pi/2`,
	</span>
	在 `[0, pi//2]` 积分得
	<span class="formula">
		`((2n)!!)/((2n+1)!!) le ((2n-1)!!)/((2n)!!) pi/2 le ((2n-2)!!)/((2n-1)!!)`.
	</span>
	于是
	<span class="formula">
    `pi/2 (2n)/(2n+1) le {:(2n)!!:}^2/((2n-1)!!(2n+1)!!) le pi/2`.
	</span>
	由两边夹法则立即得到结论.
</p>

<h3>第二类 Euler 积分: Gamma 函数</h3>

<div class="img fit" title="Gamma 函数">
  <canvas id="img-gamma" width="300" height="400"></canvas>
</div>

<span class="formula">
	`Gamma(x+1) = int_0^oo "e"^-t t^x dt`.
</span>

<p class="remark">也可以凑微分, 写成 `Gamma(x+1) = int_0^oo "e"^-t "d" t^x`.</p>

<p class="property">
	`Gamma(x)` 在 `x gt 0` 时收敛, 可在积分号下求任意阶导数:
	<span class="formula">
		`Gamma^((n))(x+1) = int_0^oo "e"^-t t^x ln^n t dt`.
	</span>
</p>

<p class="property">
	<b>递推公式</b>
	Gamma 函数满足函数方程
	<span class="formula">
		`Gamma(x+1) = x Gamma(x)`.
	</span>
	从而其定义域可以推广到除了零和负整数外的所有实数:
	<span class="formula">
		`Gamma(x) = (Gamma(x+n+1))/(x(x+1)cdots(x+n))`.
	</span>
</p>

<p class="proof">
	分部积分,
	<span class="formula">
		`Gamma(x+1) = int_0^oo "e"^-t t^x dt`
		`= -"e"^-t t^x|_0^oo + x int_0^oo "e"^-t t^(x-1) dt`
		`= x Gamma(x)`.
	</span>
</p>

<p class="remark">
  Bohr-Mollerup 定理指出, 满足上述函数方程的所有函数中, 只有 Gamma
  函数是对数凸的, 即 `ln Gamma (z)` 是凸函数.
</p>

<p class="corollary">
	`Gamma(n+1) = n!`, `n` 为非负整数.
</p>

<p class="corollary">
	令 `t = u^2` 得到 Gamma 函数的另一重要形式:
	<span class="formula">
		`Gamma(x) = 2 int_0^oo "e"^(-u^2) u^(2x-1) "d"u`.
	</span>
	利用 Poisson 积分知 `Gamma(1/2) = sqrt pi`, 再由递推公式可得 Gamma
	函数在半整数点的取值:
	<span class="formula">
		`Gamma((2n+1)/2) = ((2n-1)!!)/2^n sqrt pi`
		`= ((2n)!)/(4^n * n!) sqrt pi`.
	</span>
</p>

<table class="col2">
	<tr>
		<td>`x`</td>
		<td>`1/2`</td>
		<td>`3/2`</td>
		<td>`5/2`</td>
		<td>`7/2`</td>
	</tr>
	<tr>
		<td>`Gamma(x)//sqrt pi`</td>
		<td>`1`</td>
		<td>`1/2`</td>
		<td>`1/2 * 3/2`</td>
		<td>`1/2 * 3/2 * 5/2`</td>
	</tr>
</table>

<p class="example">
	`I_n = int_(-oo)^oo "e"^(-x^2) x^n dx`
	`= { 0, if n" is odd"; Gamma((n+1)/2), if n" is even" :}`
</p>

<p class="solution">
	`n` 是奇数时, 被积函数为奇函数, 积分为零;
	`n` 是偶数时, 被积函数为偶函数, 利用 Gamma 函数的变化形式知
	`I_n = Gamma((n+1)/2)`.
	(也可以利用第 6 章的<a href="6.html#exp-possion-integral">这个例题</a>).
</p>

<p class="property">
	<b>Dirichlet 公式</b>
	`B(x, y) = (Gamma(x)Gamma(y))/(Gamma(x+y))`.
</p>

<p class="proof">
	应用 Gamma 函数与 Beta 函数的变化形式, 并在极坐标下积分:
	<span class="formula">
		`Gamma(x) Gamma(y)`
		`= 4 int_0^oo "e"^(-u^2) u^(2x-1) "d"u
		int_0^oo "e"^(-v^2) v^(2y-1) "d"v`
		`= 4 int_0^oo int_0^oo "e"^-(u^2+v^2) u^(2x-1) v^(2y-1) "d"u"d"v`
		(令 `u = r cos theta`, `v = r sin theta`)
		`= 4 int_0^(pi//2) cos^(2x-1) theta sin^(2y-1) theta "d"theta`
		`int_0^oo "e"^(-r^2) r^(2x+2y-1) "d"r`
		`= B(x, y) Gamma(x+y)`.
	</span>
</p>

<h3>Gamma 函数的乘积表示</h3>

<p class="property">
	<b>Euler-Gauss 乘积公式</b>
	<span class="formula">
		`Gamma(s) = lim_(n to oo) (n^s n!)/(s(s+1) cdots (s+n))`.
	</span>
  使用 Gauss 的记号 `Pi(s) = Gamma(s+1)`,
	此结论简记为 `Pi(s+n) // Pi(n) ~ n^s`.
</p>

<p class="proof">
  只需证 `Gamma(s) = lim_(n to oo) n^s B(s, n+1)`:
	<span class="formula">
		`Gamma(s) = int_0^oo "e"^-t t^(s-1) dt`
		`overset ? = lim_(n to oo) int_0^n (1-t/n)^n t^(s-1) dt`
		`= lim_(n to oo) n^s int_0^1 (1-u)^n u^(s-1) "d"u`
		`= lim_(n to oo) n^s B(s, n+1)`.
	</span>
	下面证明问号处的等式. 考虑
	<span class="formula">
		`|int_0^oo "e"^-t t^(s-1) dt - int_0^n (1-t/n)^n t^(s-1) dt|`
		`le |int_0^oo ["e"^-t - (1-t/n)^n] t^(s-1) dt|`
		`+ |int_n^oo (1-t/n)^n t^(s-1) dt|`.
	</span>
	先看第一项. 由于
	<span class="formula">
		`ln (1-t/n)^n`
		`= n ln(1-t/n)`
		`= n (-t/n + O(1/n^2))`
		`= -t + O(1/n)`,
	</span>
	从而
	<span class="formula">
		`"e"^-t-(1-t/n)^n`
		`= "e"^-t(1-"e"^(O(1/n)))`
		`= "e"^-t O(1/n)`.
	</span>
	第一项等于
	<span class="formula">
		`|O(1/n) int_0^oo "e"^-t t^(s-1) dt|`
		`= O(1/n) Gamma(s) to 0`.
	</span>
	再看第二项, 由均值不等式
	<span class="formula">
		`root(n+1)((1-t/n)^n)`
		`le (n-t+1)/(n+1)`
		`= 1-t/(n+1)`
	</span>
	知道, 数列 `(1-t/n)^n` 单调递增趋于 `"e"^-t`, 即 `"e"^-t`
	是它的一个上界. 从而第二项小于等于
	<span class="formula">
		`|int_n^oo "e"^-t t^(s-1) dt|`,
	</span>
	它是收敛的 Gamma 积分的尾部, 因此当 `n to oo` 时上式趋于零.
	综上有
	<span class="formula">
		`|int_0^oo "e"^-t t^(s-1) dt - int_0^n (1-t/n)^n t^(s-1) dt|`
		`to 0`.
	</span>
</p>

<p class="proof">
	只需证
	<span class="formula">
		`lim_(n to oo) (n!)/(Gamma(s+n+1)) n^s = 1`.
	</span>
	用 Striling 公式, 上式左边等于
	<span class="formula">
		`lim_(n to oo) (sqrt n (n/"e")^n)/(sqrt(s+n) ((s+n)/"e")^(s+n)) n^s`
		`= lim_(n to oo) ("e"^s)/(1+s/n)^n (n/(s+n))^(s+1/2) = 1`.
	</span>
</p>

<p class="theorem">
    乘积公式右边的极限, 只要分母不为零, 对任意复数 `s` 都收敛.
    因此借助此公式, 可以将 `Gamma(s)` 的定义拓展到复平面上,
    `s != 0, -1, -2, cdots`. `Gamma(s)` 没有零点, 它的倒数
    `1/(Gamma(s))` 在 `CC` 上解析.
</p>

<p class="proof">
    用 `(n+1)^s` 等价代替乘积公式的 `n^s`, 记
    <span class="formula">
        `f(n) = (n!)/(s(s+1)cdots(s+n)) (n+1)^s`,
    </span>
    将公式写为无穷乘积
    <span class="formula">
        `Gamma(s) = f(0) prod_(n ge 1) (f(n))/(f(n-1))`
        `= 1/s prod_(n ge 1) n/(s+n) ((n+1)/n)^s`
        `= 1/s prod_(n ge 1) (1+s/n)^-1 (1+1/n)^s`.
    </span>
    (收敛性的说明??)
</p>

<p class="theorem">
    <b>Weierstrass 公式</b>
    <span class="formula">
        `1/(Gamma(s)) = "e"^(gamma s) s prod_(n ge 1) (1+s/n) "e"^(-s/n)`.
    </span>
    `gamma` 为 Euler-Mascheroni 常数.
</p>

<p class="proof">
    利用乘积公式, 左边等于
    <span class="formula">
        `lim_(n to oo) (s(s+1)cdots(s+n))/(n^s n!)`
        `= lim_(n to oo) "e"^(-s ln n) * s prod_(1 le k le n) (1 + s/k)`
        `= lim_(n to oo) "e"^(s (gamma - H_n)) * s prod_(1 le k le n) (1 + s/k) =` 右边.
    </span>
</p>

<p class="property">
	<b>余元公式</b>
  `Gamma(1+x) Gamma(1-x) = (pi x)/(sin pi x)`.
  这是复变量正弦函数的乘积公式.
</p>

<p class="proof">
	利用 Gamma 函数的极限表达式和 Euler 无穷乘积公式
	<span class="formula">
		`(sin pi x)/(pi x) = prod_(n=1)^oo (1-x^2/n^2)`
	</span>
	即得结论.
</p>

<p class="proof">
	<span class="formula">
		`Gamma(x) Gamma(1-x)`
		`= B(x, 1-x) Gamma(1)`
		`= int_0^oo u^(x-1)/(1+u) "d"u`.
	</span>
	利用含参积分?? 利用 Fourier 展开??
</p>

<ol class="property">
	<b>Gauss-Legendre 倍元公式</b>
	<li>`Gamma(x) Gamma(x+1/2) = (Gamma(2x))/2^(2x) 2 sqrt pi`;</li>
	<li>`prod_(0 le k lt n) Gamma(x+k/n) = (Gamma(n x))/n^(n x) sqrt n (2pi)^((n-1)/2)`.</li>
    令 `x = z + b//n` 得
    <span class="formula">
        `Gamma(n z + b) = n^(n z+b-1//2) (2pi)^((1-n)//2) prod_(0 le k lt
        n) Gamma(z + (b+k)/n)`.
    </span>
</ol>

<ol class="proof">
	<li>由于
		<span class="formula">
			`Gamma(m + 3/2)`
			`= Gamma((2m+3)/2)`
			`= (2m+1)/2 (2m-1)/2 cdots 3/2 1/2 Gamma(1/2)`
			`= ((2m+1)!)/(2^(2m+1) m!) sqrt pi`,
		</span>
		即 `(m! 2^(2m+1))/((2m+1)!) = sqrt pi /(Gamma(n+3/2)`.
		利用 Gamma 函数的 Euler 乘积表示进行计算, 我们有
		<span class="formula">
		`{:
			 , Gamma(x) Gamma(x+1/2);
       ~, (m^(2x+1/2) {:m!:}^2)/(x(x+1/2) cdots (x+m)(x+m+1/2)) quad (m to oo);
       ~, (m^(2x+1/2) {:m!:}^2 2^(2m+2))/(2x(2x+1)cdots(2x+2m+1));
       ~, (Gamma(2x))/((2m+1)^(2x)(2m+1)!) m^(2x+1/2) {:m!:}^2 2^(2m+2);
			~, (Gamma(2x))/2^(2x) (2 sqrt m m! sqrt pi)/(Gamma(n+1+1/2));
			~, (Gamma(2x))/2^(2x) 2 sqrt pi.
		:}`
		</span>
	</li>
	<li>利用三角恒等式
		<span class="formula">
			`prod_(0 lt k lt n) sin{:(k pi)/n:} = (2n)/2^n`.
		</span>
		由余元公式有
		<span class="formula">
			`prod_(0 lt k lt n) Gamma(k/n)`
			`= sqrt(prod_(0 lt k lt n) Gamma(k/n) Gamma(1-k/n))`
			`= sqrt(pi^(n-1)/(prod_(0 lt k lt n) sin{:(k pi)/n:}))`
			`= (2pi)^((n-1)/2) / sqrt n`,
		</span>
		计算
		<span class="formula">
			`prod_(0 le k lt n) Gamma(m+1+k/n)`
			`= m! prod_(0 lt k lt n) (m n+k)/n ((m-1)n+k)/n cdots (n+k)/n k/n Gamma(k/n)`
			`= ((n m+n-1)!)/n^(n m+n-1) prod_(0 lt k lt n) Gamma(k/n)`
		</span>
		我们得到
		<span class="formula">
			`n^(n m+n-1)/((n m+n-1)!)
			= (2pi)^((n-1)/2)/(sqrt n prod_(0 le k lt n) Gamma(m+1+k/n))`.
		</span>
		注意 `sum_(0 lt k lt n) k/n = (n-1)/2`, 于是
		<span class="formula">
		`{:
			,prod_(0 le k lt n) Gamma(x+k/n);
      ~, lim_(m to oo) (m^(n x + (n-1)/2) {:m!:}^n) / (x(x+1/n) cdots (x
			+ m + (n-1)/n)) quad (m to oo);
      ~, (m^(n x + (n-1)/2) {:m!:}^n n^(n(m+1))) / (n x(n x+1) cdots (n
			x+ n m + n - 1));
			~, (Gamma(n x))/((n m+n-1)^(n x) (n m+n-1)!) m^(n x+(n-1)/2)
      {:m!:}^n n^(n(m+1));
      ~, (Gamma(n x))/n^(n x) {:m!:}^n sqrt n (2pi m)^((n-1)/2)
			/( prod_(0 le k lt n) Gamma(m+1+k/n));
			~, (Gamma(n x))/n^(n x) sqrt n (2pi)^((n-1)/2).
		:}`
		</span>
	</li>
</ol>

<h3>Digamma 函数</h3>

<p class="definition">
	Gamma 函数的对数的导数称为 <b>digamma 函数</b>:
	<span class="formula">
		`psi(s) = "d"/("d"s) ln Gamma(s)`
		`= (Gamma'(s))/(Gamma(s))`,
    `quad s gt 0`.
	</span>
	digamma 函数的高阶导数 `psi^((n))` 称为 polygamma 函数.
</p>

<ol class="proposition">
  <li>`psi(s+1) = psi(s) + 1//s`;</li>
  <li>`psi(s+1) = -gamma + sum_(n ge 1) (1/n - 1/(n+s))`;
    特别 `psi(n+1) = -gamma + H_n`.
  </li>
  <li>`psi^((n))(s) = sum_(k ge 0) (n!(-1)^(n+1))/(k+s)^(n+1)`;
    特别 `psi` 在 1 附近有 Taylor 展开
    <span class="formula">
      `psi(s+1) = -gamma + sum_(n ge 1) (-1)^(n+1) zeta(n+1) s^n`.
    </span>
  </li>
</ol>

<ol class="proof">
  <li>
		`psi(s+1) = "d"/("d"s) ln Gamma(s+1)`
		`= "d"/("d"s)(ln s + ln Gamma(s))`
		`= 1/s + psi(s)`.
  </li>
  <li>由递推公式
    <span class="formula">
      `psi(n+1) = psi(1) + sum_(k=1)^n 1/k = psi(1) + H_n`.
    </span>
    为求出 `psi(1)`, 使用 Weierstrass 公式:
    <span class="formula">
      `ln Gamma(s) = -gamma s - ln s + sum_(n ge 1)(s/n - ln(1+s/n))`,
      <br/>
      `psi(s) = -gamma - 1/s + sum_(n ge 1)(1/n - 1/(n+s))`,<br/>
      即 `psi(s+1) = -gamma + sum_(n ge 1)(1/n - 1/(n+s))`.
    </span>
    因此 `psi(1) = -gamma`.<br/>
    从另一角度, 交换积分与求和,
    <span class="formula">
        `int_0^1 sum_(n ge 1) (1/n - 1/(n+s)) "d"s`
        `= sum_(n ge 1) (1/n - ln(1+1/n))`
        `= lim_(n to oo) H_n - ln(n+1)`
        `= gamma`.
    </span>
    但 `int_0^1 psi(s+1) "d"s = ln Gamma(2) - ln Gamma(1) = 0`,
    两式相减, 再次印证了 `psi(1) = -gamma`.
  </li>
  <li>直接求导即可.</li>
</ol>

<h3>Stirling 公式</h3>

<p>	下文推导阶乘函数的 Stirling 公式, 为此先证明一个 (冗长但实用的) 引理.</p>

<p class="lemma">
	<b>Laplace 方法</b>
	设 `f in C^2[a,b]`.  `x_0 in (a,b)` 是 `f` 唯一的极大值点, `f''(x_0)
	= -lambda lt 0`, 则
	<span class="formula">
		`int_a^b "e"^(M f(x)) dx\ ~\ "e"^(M f(x_0)) sqrt((2pi)/(M lambda))`,
		`quad M to oo`.
	</span>
	这意味着 `"e"^(M f(x))` 在整个区间上的积分值几乎都集中在 `x_0` 附近,
	且可以用 `f` 的二阶 Taylor 展开
	<span class="formula">
		`int_(-oo)^oo "e"^(M f(x_0) - M lambda(x-x_0)^2/2) dx`
	</span>
	来估计.
</p>

<p class="proof">
	将 `f` 在 `x_0` 处展开, 因为是极大值点, `f'(x_0) = 0`, 有
	<span class="formula">
		`f(x) = f(x_0) + f''(x_0+theta(x-x_0)) (x-x_0)^2/2`.
	</span>
	由二阶导数连续, 对任意 `epsi gt 0`, 当 `x` 与 `x_0` 充分接近时,
	<span class="formula">
		`f''(x_0)-epsi le f''(x_0+theta(x-x_0)) le f''(x_0)+epsi`,
	</span>
	从而
	<span class="formula">
		`f(x_0) - (lambda+epsi) (x-x_0)^2/2`
		`le f(x)`
		`le f(x_0) - (lambda-epsi) (x-x_0)^2/2`.
	</span>
	取 `delta gt 0` 充分小. 一方面, 注意到 `int_(-oo)^oo "e"^(-y^2/2) dy
	= sqrt (2pi)`, 有
	<span class="formula">
		`int_a^b "e"^(M f(x)) dx`
		`ge int_(x_0-delta)^(x_0+delta)
		"e"^(M f(x_0)-M(lambda+epsi)(x-x_0)^2/2) dx`
		`= int_(-delta sqrt(M(lambda+epsi)))^(delta sqrt(M(lambda+epsi)))
		"e"^(M f(x_0) - y^2/2)/sqrt(M(lambda+epsi)) dy`
		`~ "e"^(M f(x_0)) sqrt((2pi)/(M(lambda+epsi)))`;
	</span>
	另一方面, 由 `x_0` 是唯一的极大值点知, 存在 `eta gt 0` 使得
	<span class="formula">
		`f(x) le f(x_0)-eta`, `quad |x-x_0| ge delta`.
		<span class="label" id="for-eta-condition"></span>
	</span>
	不妨设 `lambda-epsi gt 0`, 得到
	<span class="formula">
		`int_a^b "e"^(M f(x)) dx`
		`= int_a^(x_0-delta) + int_(x_0-delta)^(x_0+delta)
		+ int_(x_0+delta)^b`
		`le (b-a)"e"^(M(f(x_0)-eta)) + int_(x_0-delta)^(x_0+delta)
		"e"^(M f(x_0)-M(lambda-epsi)(x-x_0)^2/2) dx`
		`~ "e"^(M f(x_0)) ((b-a)"e"^(-M eta) + sqrt((2pi)/(M(lambda-epsi))))`
		`~ "e"^(M f(x_0)) sqrt((2pi)/(M(lambda-epsi)))`.
	</span>
	令 `epsi to 0`, 由两边夹法则即得结论.
</p>

<p class="remark">
	若 `[a, b]` 是无限区间, 要使引理成立, 还需两个充分条件. 一是满足条件
	<a class="ref" href="#for-eta-condition"></a> 的 `eta` 存在,
	二是存在 `M_0 gt 0`, 使得 `int_a^b "e"^(M_0 f(x)) dx lt oo`.
	此时有
	<span class="formula">
		`int_a^(x_0-delta) "e"^(M f(x)) dx + int_(x_0+delta)^b "e"^(M
		f(x)) dx`
		`le int_a^b "e"^(M_0 f(x)) "e"^((M-M_0) f(x)) dx`
		`le int_a^b "e"^(M_0 f(x)) "e"^((M-M_0) (f(x_0)-eta)) dx`
		`= O("e"^((M-M_0) (f(x_0)-eta)))`,
	</span>
	代入前面的证明, 得到相同的结果.
</p>

<p class="theorem">
	<b>Stirling 公式</b> `n! ~ sqrt(2pi n) (n/"e")^n`, `quad n to oo`.
</p>

<p class="proof">
	利用 Gamma 函数,
	<span class="formula">
		`n! = Gamma(n+1)`
		`= int_0^oo "e"^(-t) t^n dt`
		(令 `t = n x`)
		`= n^(n+1) int_0^oo "e"^(-n x) x^n dx`
		`= n^(n+1) int_0^oo "e"^(n(ln x-x)) dx`.
	</span>
	应用 Laplace 方法, 其中
	<span class="formula">
		`f(x) = ln x-x`, `quad f'(x) = 1/x-1`, `quad f''(x)
		  = -1/x^2`,<br/>
		`f'(1) = 0`, `quad f(1) = f''(1) = -1`.
	</span>
	有
	<span class="formula">
		`n! ~ n^(n+1) "e"^-n sqrt((2pi)/n)`
		`= sqrt(2pi n) (n/"e")^n`.
	</span>
</p>

<h2>Riemann zeta 函数</h2>

<table>
  <tr>
    <td>Riemann zeta 函数</td>
    <td>`zeta(s) = sum_(n ge 1) 1/n^s`</td>
  </tr>
  <tr>
    <td>Dirichlet eta 函数</td>
    <td>`eta(s) = sum_(n ge 1) (-1)^(n+1)/n^s` `= (1-2^(1-s)) zeta(s)`</td>
  </tr>
  <tr>
    <td>`beta(s)`</td>
    <td>`beta(s) = sum_(n ge 0) (-1)^n/(2n+1)^s`</td>
  </tr>
</table>

<p class="example">
  [来自 论文哥] 对 `s gt 0` 有
  <span class="formula">
    `zeta(s) Gamma(s) = int_0^oo x^(s-1)/("e"^x-1) dx`,<br>
    `eta(s) Gamma(s) = int_0^oo x^(s-1)/("e"^x+1) dx`.
  </span>
</p>

<p class="proof">
  记第一个公式右边的积分为 `I`. 化为几何级数并逐项积分有
  <span class="formula">
    `I = int_0^oo x^(s-1) sum_(n ge 1) "e"^(-n x) dx`
    `= sum_(n ge 1) 1/n^s int_0^oo t^(s-1) "e"^-t dt`
    `= zeta(s) Gamma(s)`.
  </span>
  第二个公式的证明类似.
</p>

<div class="p example">
  [来自 我是不万能的洛必达]
  <span class="formula">
    `sum_(n ge 1) H_n/n^2`
    `= 2 sum_(n ge 2) H_(n-1)/n^2`
    `= sum_(m, n ge 1) 1/(m n(m+n))`
    `= 2 zeta(3)`.
  </span>
  前三个级数收敛缓慢, 取一万项后仍与目标有较大差距; 但 zeta(3) 收敛较快.
<pre>
&gt;&gt;&gt; sum(1/n**3 for n in range(1, 10000))
1.202056898159098
&gt;&gt;&gt; sum(sum(1/(m*n*(m+n)) for m in range(1, 100)) for n in range(1, 100))
2.293828375511741
</pre>
</div>

<ol class="proof">
  上式记为 (1) = (2) = (3) = (4).
  <li>令 `t = m + n` 得
    <span class="formula">
      `(2) = sum_(t ge 2) 1/t^2 sum_(n=1)^(t-1) (1/n + 1/(t-n))`
      `= sum_(t ge 2) sum_(n=1)^(t-1) 1/(t n (t-n))`
      `= (3)`.
    </span>
  </li>
  <li>利用积分 `int_0^oo "e"^(-lambda x) dx = 1/lambda` 得
    <span class="formula">
      `(3) = sum_(m, n ge 1) 1/(m n) int_0^oo "e"^(-(m+n)x) dx`
      `= int_0^oo (sum_(n ge 1) "e"^(-n x)/n)^2 dx`
      `= int_0^oo ln^2 (1-"e"^-x) dx`
      `= -int_(-oo)^0 t^2 "d"ln (1-"e"^t)`
      `= int_(-oo)^0 t^2 "e"^t/(1-"e"^t) dt`
      `= int_0^oo t^2 "e"^-t/(1-"e"^-t) dt`
      `= zeta(3) Gamma(3) = (4)`.
    </span>
  </li>
  <li>
    最后
    <span class="formula">
      `(1) - zeta(3)`
      `= sum_(n ge 1) (H_n - 1//n)/n^2`
      `= sum_(n ge 2) H_(n-1)/n^2 = (2)//2`.
    </span>
    于是 (1) = (2).
  </li>
</ol>

<p class="example">
  `sum_(n ge 1) H_n^2/n^2 = 17/4 zeta(4) = 17/360 pi^4`.
</p>

<h2>超越函数的积分</h2>

<h3>多重对数积分</h3>

<p class="definition">
  `n` 阶多重对数积分在单位圆盘上定义为
  <span class="formula">
    `"Li"_n(z) = sum_(k ge 1) z^k/k^n`, `quad n in ZZ, |z| lt 1`,
  </span>
  通过解析延拓可以将定义域扩展到整个复平面.
</p>

<ol class="corollary">
  <li>`"Li"_(-1)(x) = x/(1-x)^2`,
    `"Li"_0(x) = x/(1-x)`,
    `"Li"_1(x) = -ln(1-x)`;</li>
  <li>`"Li"_n(1) = zeta(n)`, `"Li"_n(-1) = -eta(n)`;</li>
  <li>`"Li"_n(x) = int_0^x ("Li"_(n-1)(t))/t dt`;
    换言之 `"d"/dx "Li"_n(x) = ("Li"_(n-1)(x))/x`.
  </li>
</ol>

<p class="proof">
  只证最后一个结论,
  <span class="formula">
    `"Li"_n(x) = sum_(k ge 1) int_0^x t^(k-1)/k^(n-1) dt`
    `= int_0^x sum_(k ge 1) t^k/k^(n-1) dt/t`
    `= int_0^x ("Li"_(n-1)(t))/t dt`.
  </span>
</p>

<ol class="example">
  <li>`"Li"_2(x) + "Li"_2(1-x) = pi^2/6 - ln x ln(1-x)`, 特别
  `"Li"_2(1/2) = pi^2/12 - (ln^2 2)/2`;</li>
  <li>`"Li"_3(1/2) = (ln^3 2)/6 - pi^2/12 ln 2 + 7/8 zeta(3)`;</li>
  <li>`int_0^(pi/2) x ln sin x dx = 7/16 zeta(3) - pi^2/8 ln 2`;</li>
</ol>

<ol class="proof">
  <li>
    两边求导,
    <span class="formula">
      `("Li"_1(x))/x - ("Li"_1(1-x))/(1-x)`
      `= -ln(1-x)/x + ln x/(1-x)`
    </span>
    等号成立; 且 `x to 0^+` 时原式等号成立, 证毕.
  </li>
  <li></li>
  <li>[来自某数学系 dalao] 利用 Fourier 展开
    <span class="formula">
      `ln sin x = -ln 2 - sum_(n ge 1) (cos 2 n x)/n`
    </span>
    逐项积分, 原式等于
    <span class="formula">
      `- pi^2/8 ln 2 - sum_(n ge 1) 1/n int_0^(pi/2) x cos 2 n x dx`
      `= - pi^2/8 ln 2 - sum_(n ge 1) 1/n ((-1)^n - 1)/(4n^2)`
      `= - pi^2/8 ln 2 + 1/4 (zeta(3) + eta(3))`
      `= - pi^2/8 ln 2 + 7/16 zeta(3)`.
    </span>
  </li>
</ol>

<p class="example">
  <b>一类多重对数积分</b>
  [来自 <a href="https://zhuanlan.zhihu.com/p/396955692">知乎</a>]
  <span class="formula">
    `bb(i a b c 0) = int_0^1 (ln^a(1-x) ln^b ln^c(1+x))/(1-x) dx`,<br>
    `bb(i a b c 1) = int_0^1 (ln^a(1-x) ln^b ln^c(1+x))/x dx`,<br>
    `bb(i a b c 2) = int_0^1 (ln^a(1-x) ln^b ln^c(1+x))/(1+x) dx`.
  </span>
  其中 `a + b + c + 1 := n` 称为这个积分的权 (weight).
  权为 `n` 的多重对数积分的值可以用 `"Li"_k(1) = zeta(k)` 和
  `"Li"_k(1/2)` 表示, 其中 `k le n`. 我们仅举一例:
  <span class="formula">
    `bb(i n 001)`
    `==^(x mapsto 1-x) bb(i0n00)`
    `==^(x mapsto "e"^-x) (-1)^n Gamma(n+1)zeta(n+1)`.
  </span>
</p>

<h3>多重指数积分</h3>

<p class="definition">
	设 `n` 为非负整数, (Schlömilch's) `n` 阶指数积分定义为
	<span class="formula">
		`E_n(x) = int_1^oo "e"^(-x t)/t^n dt`, `quad x gt 0`.
	</span>
  特别 `E_0(x) = "e"^-x/x`, `E_n(x) = x^(n-1) int_x^oo "e"^-u/u "d"u` (`n
  ge 1`).
</p>

<p class="proposition">
	分部积分可证, `n E_(n+1)(z) = "e"^-z - z E_n(z)`.
</p>

<p class="proposition">
	设 `x gt 0`, `n ge 1`, 则
	<span class="formula">
		`1/(x+n) lt "e"^x E_n(x) lt 1/(x+n-1)`.
	</span>
  此外 `n = 0` 时左边的等号成立.
</p>

<p class="proof">
	对任意 `t gt 1` 有 `t-1 gt ln t`, 因此
	<span class="formula">
		`-x(t-1) lt -x ln t`,
	</span>
	取指数,
	<span class="formula">
		`"e"^(x(1-t)) lt t^-x`,
	</span>
	积分
	<span class="formula">
		`"e"^x E_n(x) = int_1^oo "e"^(x(1-t))/t^n dt`
		`lt int_1^oo t^(-n-x) dt`
		`= 1/(n+x-1)`.
	</span>
  利用已证得的 `E_(n+1)(x) lt ("e"^-x)/(x+n)`, `n ge 1`, 有
  <span class="formula">
    `E_n(x) = ("e"^-x - n E_(n+1)(x))/x`
    `gt "e"^-x/x (1 - n/(x+n))`
    `= "e"^-x/(x+n)`, `quad n ge 1`.
  </span>
</p>

<h3>指数积分与对数积分</h3>

<ol class="definition">
    <li><b>指数积分</b> `"Ei"(x) = -E_1(-x) = int_(-oo)^x "e"^t/t dt`.
      `x gt 0` 时, 取 Cauchy 主值 `lim_(epsi to 0+)
      int_(-oo)^-epsi + int_epsi^x`. 在复平面上, `"Ei"(z)` 有唯一极点
      `z = 0`.
    </li>
    <li><b>对数积分</b> `"li"(x) = int_0^x dt/(ln t)`.
      `x gt 1` 时, 取 Cauchy 主值
      `lim_(epsi to 0^+) int_0^(1-epsi) + int_(1+epsi)^x`.
      在复平面上, `"li"(z)` 有唯一极点 `z = 1`.
    </li>
    <li><b>正弦积分</b> `"Si"(x) = int_0^x (sin t)/t dt`.  </li>
    <li><b>余弦积分</b> `"Ci"(x) = gamma + ln x + int_0^x (cos t - 1)/t dt`.
    </li>
</p>

<ol class="proposition">
    <li>`"li"(x) = "Ei"(ln x)`;</li>
    <li>`"Ei"("i"x) = "Ci"(x) + "i"(pi/2 + "Si"(x))`;</li>
</ol>

<p class="proposition">
    `"Ei"(z) = gamma + ln z + sum_(k ge 1) z^k/(k * k!)`.
</p>

<p class="proof">
    `"Ei"(z) = int_(-oo)^x "e"^t/t dt`
    `= int_(-oo)^x sum_(n ge 0) t^(n-1)/(n!) dt`
    `overset ? = sum_(n ge 0) int_(-oo)^x t^(n-1)/(n!) dt`
    `= ln x - ln (-oo) + sum_(n ge 1) x^n(n*n!)` ??
</p>

<p class="theorem">
    <b>素数定理</b>
    记 `pi(x)` 为小于 `x` 的素数个数,
    <span class="formula">
        `"Li"(x) = int_2^x dt/(ln t) = "li"(x) - "li"(2)`,
    </span>
    则 `x to oo` 时, `pi(x) ~ "Li"(x)`.
</p>

<h3>Catalan 常数</h3>

<ol class="example">
	[来自 论文哥]
	`beta(2) = sum_(n ge 0) (-1)^n/(2n+1)^2` 称为 <b>Catalan 常数</b>:
	<span class="formula">
		`K = 0.915965594177...`
	</span>
  也有用 `G` 或 `C` 表示 Catalan 常数的. 由此计算:
	<li>`int_0^1 int_0^1 1/(1+x^2 y^2) dx dy = K`;</li>
	<li>`int_0^1 (arctan x)/x dx = K`;</li>
	<li>`int_0^1 (ln x)/(1+x^2) dx`
		`= -1/2 int_0^(pi/2) x csc x dx`
		`= int_0^(pi/4) ln tan x dx`
		`= -K`;
	</li>
	<li>`int_0^(pi/4) ln sin x dx` 和 `int_0^(pi/4) ln cos x dx`;</li>
    <li>`int_0^(pi/2) ln(1+cos x) dx` `= int_0^(pi/2) ln(1+sin x) dx`;</li>
	<li>`int_0^(sqrt2/2) (ln x)/sqrt(1-x^2) dx`,
		`int_0^(sqrt 2/2) (arcsin x)/x dx` 和 `int_0^(pi/4) x cot x dx`;
	</li>
	<li>`int_0^(1/2) Gamma(1+x)Gamma(1-x) dx`.</li>
</ol>

<ol class="solution">
	<li>将分母以几何级数展开, 收敛域为 `[-1, 1]`, 可以逐项积分.  原式等于
		<span class="formula">
			`int_0^1 int_0^1 sum_(n ge 0) (-x^2 y^2)^n dx dy`
			`= sum_(n ge 0) (-1)^n
			int_0^1 x^(2n) dx int_0^1 y^(2n) dy`
			`= sum_(n ge 0) (-1)^n/(2n+1)^2 = K`.
		</span>
	</li>
	<li>利用 `arctan x = sum_(n ge 0) (-1)^n x^(2n+1)/(2n+1)`, 原式等于
		<span class="formula">
			`int_0^1 sum_(n ge 0) (-1)^n x^(2n)/(2n+1) dx`
			`overset ? = sum_(n ge 0) (-1)^n/(2n+1) int_0^1 x^(2n) dx`
			`= sum_(n ge 0) (-1)^n/(2n+1)^2`
			`= K`.
		</span>
	</li>
	<li>分部积分,
		<span class="formula">
			`int_0^1 (arctan x)/x dx = - int_0^1 (ln x)/(1+x^2) dx`.
		</span>
		令 `t = arctan x`,
		<span class="formula">
			`int_0^1 (arctan x)/x dx = int_0^(pi/4) t/(sin t cos t) dt`
			`= 1/2 int_0^(pi/2) (t dt)/(sin t)`,<br/>
			`int_0^1 (ln x)/(1+x^2) dx = int_0^(pi/4) ln tan t dt`.
		</span>
	</li>
	<li>两个积分分别记为 `I, J`, 于是
		<span class="formula">
			`I+J = int_0^(pi/4) ln{:(sin 2x)/2:} dx`
			`= 1/2 int_0^(pi/2) ln sin x dx - pi/4 ln 2`
			`= - pi/2 ln 2`,<br/>
			`I-J = int_0^(pi/4) ln tan x dx = -K`.
		</span>
		解线性方程组即得到 `I, J = -pi/4 ln 2 &mp; K/2`.
	</li>
    <li>由上题易得结果为 `2K - pi/2 ln 2`.</li>
	<li>令 `x = sin t`,
		<span class="formula">
			`int_0^(sqrt2/2) (ln x)/sqrt(1-x^2) dx`
			`= int_0^(pi/4) ln sin t dt`.
		</span>
		另外两个积分的处理方法和
    <a href="7.html#exp-pi-ln2">`int_0^(pi/2) ln sin x dx`</a>
    一样, 先换元再分部积分, 得
		<span class="formula">
			`int_0^(sqrt2/2) (arcsin x)/x dx`
			`= int_0^(pi/4) t cot t dt`
			`= -pi/8 ln 2 - int_0^(pi/4) ln sin t dt`
			`= pi/8 ln 2 + K/2`.
		</span>
	</li>
	<li>原式等于
		<span class="formula">
			`int_0^(1/2) x Gamma(x) Gamma(1-x) dx`
			`= int_0^(1/2) (pi x)/(sin pi x) dx` (余元公式)
			`= 2/pi K` (由 3).
		</span>
	</li>
</ol>

<ol class="example">
	<li>`1 - 1/(n!) int_0^n t^n "e"^-t dt = "e"^-n sum_(k=0)^n n^k/(k!)`;
	</li>
	<li>(Dobiński 公式) `n to oo` 时上式两边趋于 `1/2`.</li>
</ol>

<ol class="proof">
	<li>一种做法是对左边反复分部积分. 第二种做法从右边出发,
		利用 gamma 函数定义及二项式定理有
		<span class="formula">
			`"e"^-n sum_(k=0)^n n^k/(k!)`
			`= "e"^-n/(n!) sum_(k=0)^n (n;k) n^k (n-k)!`
			`= "e"^-n/(n!) sum_(k=0)^n (n;k) n^k int_0^oo t^(n-k) "e"^-t
			dt`
			`= "e"^-n/(n!) int_0^oo (n+t)^n "e"^-t dt`
			`= 1/(n!) int_n^oo t^n "e"^-t dt`
			`= 1 - 1/(n!) int_0^n t^n "e"^-t dt`.
		</span>
	</li>
	<li>利用等式
		<span class="formula">
			`sum_(k=0)^n n^k/(k!) = sum_(k=0)^n (k^k (n-k)^(n-k))/(k!
			(n-k)!)`, (规定 `0^0 = 1`) (??)
		</span>
		有
		<span class="formula">
			`lim_(n to oo) "e"^-n sum_(k=0)^n n^k/(k!)`
			`= lim_(n to oo) "e"^-n sum_(k=1)^(n-1) ("e"^k
			"e"^(n-k))/(sqrt(2pi k) sqrt(2pi(n-k)) O(1+1/k) O(1+1/(n-k)))`
			`= lim_(n to oo) 1/(2 pi n) sum_(k=1)^(n-1) 1/sqrt(k/n
			(1-k/n))`
			`= 1/(2pi) int_0^1 dx/sqrt(x(1-x))`
			`= 1/(2pi) (Gamma(1/2)^2)/(Gamma(1)) = 1/2`.
		</span>
	</li>
</ol>

<p class="proof">
	2. 的另一证法. 设 `X_1, X_2, cdots, X_n` 独立服从参数为 1 的 Poisson
	分布, 则 `X = X_1 + X_2 + cdots + X_n` 服从参数为 `n` 的 Poisson 分布.
	<span class="formula">
		`P{X le n} = "e"^-n sum_(k=0)^n n^k/(k!)`.
	</span>
	令 `n to oo`, 由中心极限定理
	<span class="formula">
		`(X-n)/sqrt n to Z`, `quad Z ~ N(0, 1)`,
	</span>
	于是 `P{X le n} to P{Z le 0} = 1/2`.
</p>

<script src="../../js/note.js?type=math"></script>
<script src="../../js/plot.js"></script>
<script>
const Gamma = s => {
  const N = 1000
  let ret = N**s/s
  for (let n = 1; n <= N; ++n) {
    ret *= n / (s+n)
  }
  return ret
}

new Plot('img-gamma')
  .geometry({xmin: -5, xmax: 5, ymin: -5, ymax: 7}).axis({ytick: 2})
  .plot(Gamma, {continuity: 1e3})
</script>
</body>
</html>
